﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO;

namespace EngineeringMaster.Student
{
    public partial class SelectCourse : System.Web.UI.Page
    {
        private string courseType;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                courseType = Request.Params["CourseType"].ToString();
            }
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            LinkButton lkb = (LinkButton)sender;
            string courseId = lkb.CommandArgument.ToString();
            string studentId = Session["StudentId"].ToString();
            CourseDAO courseDao = new CourseDAO();
            if(courseDao.selectCourse(studentId, courseId))
            {
               // Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除成功。')</script>");
                this.GridView1.DataBind();
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('选择失败。')</script>");
            }
        }
    }
}
